package com.minke.ch10springbootdubboconsumer.controller;

import DTO.ProviderTestDTO;
import Service.IProviderService;
import VO.ResultVO;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 何杨谊
 * @description: TODO
 * @date 2022/4/3 18:40
 */
@RestController
@RequestMapping("/consumer")
public class ConsumerController {
    @Reference
    private IProviderService providerService;

    @RequestMapping(value = "/list",method = RequestMethod.GET)
    public ResultVO getList(){
        // 远程调用
        List<ProviderTestDTO> providerTestDTOList = providerService.queryList();
        return new ResultVO.Builder<>().code(200).message("success").data(providerTestDTOList).build();
    }
}
